/**
 * 根据当前页面路由信息获取当前产品的产品id和产品类型
 * @param {*} to 当前页面的路由信息
 * @returns 当前产品类型和产品id
 */
function getLoginSource(to) {
  let prodInfo = {
    prodType:'',
    prodId:'',
  };
  if (to.path.includes('homePage/live/liveRoom') || to.path.includes('homePage/live/liveDetail')) {
    let prodId = to.query.liveId || '';
    prodInfo = {
      prodType: global.ckFrom.live,
      prodId: prodId
    }
    return prodInfo;
  }
  if (to.path.includes('homePage/live/liveVHRoom') || to.path.includes('homePage/live/livePersonalDetail')) {
    let prodId = to.query.liveId || '';
    prodInfo = {
      prodType: global.ckFrom.personalLive,
      prodId: prodId
    }
    return prodInfo;
  }
  if (to.path.includes('homePage/privateClass/classDetail') || to.path.includes('homePage/privateClass/classLiveList') || to.path.includes('homePage/privateClass/privateLiveRoom') ) {
    let prodId = to.query.classId || to.query.liveId || '';
    prodInfo = {
      prodType: global.ckFrom.privateClass,
      prodId: prodId
    }
    return prodInfo;
  }
  if (to.path.includes('homePage/socialGroup/socialGroupInfo') || to.path.includes('homePage/socialGroup/chatRoom')) {
    let prodId = to.query.SocialRoomId || '';
    prodInfo = {
      prodType: global.ckFrom.social,
      prodId: prodId
    }
    return prodInfo;
  }
  if (to.path.includes('homePage/course/video')) {
    let prodId = to.query.courseId || '';
    prodInfo = {
      prodType: global.ckFrom.video,
      prodId: prodId
    }
    return prodInfo;
  }
  if (to.path.includes('homePage/course/voice')) {
    let prodId = to.query.courseId || '';
    prodInfo = {
      prodType: global.ckFrom.voice,
      prodId: prodId
    }
    return prodInfo;
  }
  if (to.path.includes('homePage/course/imgText')) {
    let prodId = to.query.courseId || '';
    prodInfo = {
      prodType: global.ckFrom.imgText,
      prodId: prodId
    }
    return prodInfo;
  }
  if (to.path.includes('homePage/column/columnDetail')) {
    let prodId = to.query.extId || '';
    prodInfo = {
      prodType: global.ckFrom.column,
      prodId: prodId
    }
    return prodInfo;
  }
  if (to.path.includes('homePage/package/packageDetail')) {
    let prodId = to.query.combosId || '';
    prodInfo = {
      prodType: global.ckFrom.package,
      prodId: prodId
    }
    return prodInfo;
  }
  if (to.path.includes('homePage/camp/campDetail')) {
    let prodId = to.query.campId || '';
    prodInfo = {
      prodType: global.ckFrom.camp,
      prodId: prodId
    }
    return prodInfo;
  }
  return prodInfo;
}
export {
  getLoginSource
}